<%@ include file="/WEB-INF/templates/jsp/include.jsp"%>
<%@ taglib prefix="basic" uri="http://ciracas.basic.org/tags-ui"%>

<script type="text/javascript">
    function doSave()
    {
        with(document.getElementById("commandCustomer"))
        {
        	action = "<%=request.getContextPath()%><spring:message code="app.url.base"/>/administrative/customer/saveform";
            submit();
        }
    }

    function doCancel()
    {
        with(document.getElementById("commandCustomer"))
        {
            id.value = '';
            action = "<%=request.getContextPath()%><spring:message code="app.url.base"/>/administrative/customer/cancelform";
			method = "GET";
			submit();
		}
	}
</script>
<div class="cssLevelTitle">
<h2><spring:message code="label.inputData" />&nbsp;<spring:message
	code="label.customer" /></h2>
</div>
<c:if test="${not empty commandCustomer.msgList}">
	<br>
	<div style="color: red; font-size: 11px; font-weight: bold;">
	<ul>
		<c:forEach items="${commandCustomer.msgList}" var="errMsg"
			varStatus="errMsgSt">
			<li>${errMsg}
		</c:forEach>
	</ul>
	</div>
</c:if>
<form:form commandName="commandCustomer" cssStyle="feedbackform"
	method="post">
	<form:hidden path="strAction" />
	<form:hidden path="id" />
	
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.firstname" />
		</label>
		<div class="thefield">
			<form:input path="firstname" maxlength="35" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="firstname" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.surname" />
		</label>
		<div class="thefield">
			<form:input path="surname" maxlength="35" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="surname" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.dob" />
		</label>
		<div class="thefield">
			<form:input path="dob" maxlength="10" cssErrorClass="form-error-field" />
			<basic:calendar field="dob" />
		</div>
		<div class="form-error-message"><form:errors path="dob" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.address" />
		</label>
		<div class="thefield">
			<form:input path="address1" maxlength="70" cssErrorClass="form-error-field" />
			<br/>
			<form:input path="address2" maxlength="70" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message">
			<form:errors path="address1" />
			<br/>
			<form:errors path="address2" />
		</div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.suburb" />
		</label>
		<div class="thefield">
			<form:input path="suburb" maxlength="50" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="suburb" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.postalcode" />
		</label>
		<div class="thefield">
			<form:input path="postalCode" maxlength="6" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="postalCode" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.state" />
		</label>
		<div class="thefield">
			<form:input path="state" maxlength="50" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="state" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled"><spring:message code="label.country" /></label>
		<div class="thefield">
			<form:select  path="countryId"
				items="${commandCustomer.countryList}" 
				itemLabel="name" 
				itemValue="id"
				cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="countryId" /></div>
	</div>	
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.homephone" />
		</label>
		<div class="thefield">
			<form:input path="homephone" maxlength="15" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="homephone" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.workphone" />
		</label>
		<div class="thefield">
			<form:input path="workphone" maxlength="15" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="workphone" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.mobile" />
		</label>
		<div class="thefield">
			<form:input path="mobile" maxlength="15" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="mobile" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.email1" />
		</label>
		<div class="thefield">
			<form:input path="email1" maxlength="170" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="email1" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.email2" />
		</label>
		<div class="thefield">
			<form:input path="email2" maxlength="170" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="email2" /></div>
	</div>

	<div class="fieldwrapper">
		<label class="styled">
			<spring:message code="label.idnumber" />
		</label>
		<div class="thefield">
			<form:input path="idnumber" maxlength="50" cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="idnumber" /></div>
	</div>
	<div class="fieldwrapper">
		<label class="styled"><spring:message code="label.identity" /></label>
		<div class="thefield">
			<form:select  path="identificationId"
				items="${commandCustomer.identityList}" 
				itemLabel="name" 
				itemValue="id"
				cssErrorClass="form-error-field" />
		</div>
		<div class="form-error-message"><form:errors path="countryId" /></div>
	</div>

	<div>
		<basic:button type="button" title="button.save" onclick="doSave();" />
		&nbsp;<basic:button type="reset" title="button.reset" />
		&nbsp<basic:button type="button" title="button.cancel" onclick="doCancel();" />
	</div>
</form:form>